//= require jquery
//= require jquery_ujs
//= require jquery-2.1.1.min
//= require jasny-bootstrap.min
//= require bootstrap-sprockets
//= require bootstrap.min
//= require bootstrap-dialog
//= require sidebar
//= require common
//= require sale_app
//= require jquery.serializejson
//= require bootstrap-datetimepicker.min
//= require_tree ../templates/sales


// This is ? params(url)
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg);  //匹配目标参数
    if (r != null) return unescape(r[2]); return null; //返回参数值
}

// This is path params
function getPathParam(name) {
  var  url= window.location.href
  var  array = url.split('/');
  for(var i =0; i < array.length; i++){
      if(array[i]== name)
      return array[i+1]
  }
}

function getStoreId(){
  var id = getUrlParam("store_id")
  return id
}


jQuery(function($){
  // toggle header profile
  $("a.js-toggle-profile").on("click", function(){
    $("ul.dropdown-menu.extended.logout").toggle();
  })
})


$.ajaxSetup({
  headers: {
    'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
  }
});
